﻿using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyServer.Common.Tools
{
    /// <summary>
    /// 为相关操作器提供数据包队列存储
    /// </summary>
    public class DataPackageQueue : ConcurrentQueue<DataPackageCollection>
    {
        private object lockObj=new object();
        /// <summary>
        /// 清除队列中所有的数据
        /// </summary>
        public void Clear()
        {
            lock (lockObj)
            {
                DataPackageCollection col;
                while (!this.IsEmpty)
                {
                    this.TryDequeue(out col);
                }
            }
        }
    }
}
